var table;
var layer;
layui.use(['layer','table'],function(){
    table=layui.table;
    layer=layui.layer;

    //获取路由跳转过来的课程·id
    var idArray = window.location.search.split("?");
    var log_id = idArray[1];
    selCourseLog(log_id);
});


//获取课程日志
function selCourseLog(log_id) {
    $.ajax({
        url: "/SyOperationController/selCourseLog",
        type: "post",
        dataType: "json",
        data:{"type":2,"log_id":log_id},
        success: function (data) {
            getTable(data.data);
        }
    });
}

//获取课程日志赋值给table
function getTable(data){
    var tb1=table.render({
        elem:"#table_id",
        title:"课程日志",
        limit:10,
        data:data,
        page:true,
        cols:[[
            {field:'course_id',title:'课程编号',align:'center'},
            {field:'course_name',title:'课程名称',align:'center'},
            {field:'course_nprice',title:'销售价格',templet:function(d){
                    return "<p style='margin-left: 60px'>原："+d.course_nprice+" 元</p>" +
                        "<p style='margin-left: 60px'>现："+d.course_price+" 元</p>"
                }},
            {field:'course_status',title:'上下架',align:'center',templet:function(d){
                    if(d.course_status==2){
                        return  "上架中"
                    }else if(d.course_status==3){
                        return  "未上架"
                    }else{
                        return  "异常"
                    }
                }},
            {field:'course_cstatus',title:'审核状态',align:'center',templet:function(d){
                    if(d.course_cstatus==3){
                        return  "未审核"
                    }else if(d.course_cstatus==4){
                        return  "审核中"
                    }else if(d.course_cstatus==5){
                        return  "审核失败"
                    }else if(d.course_cstatus==6){
                        return  "其它"
                    }else{
                        return  "异常"
                    }
                }}
        ]]
    });
}

//刷新
function refresh() {
    location.reload();
}


